<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function Parent() {
      this.money = 100000
      this.head = 1
      this.hobbies = ['reading', 'fight', 'sleep']
    }

    function Child(name, age) {
      // 将父对象的构造函数绑定在子对象中
      Parent.call(this)
      this.name = name
      this.age = age
    }

    var son = new Child('jiffy', 22)
    var girl = new Child('jude', 18)

    son.hobbies.push('coding')
    girl.hobbies.splice(1, 1)

    alert(Child.prototype.constructor)
    alert(Parent.prototype.constructor)

    alert(son.hobbies)
    alert(girl.hobbies)

  </script>
</body>

</html>